/*
 * @Description:
 * @Date: 2024-05-14 08:44:08
 * @LastEditTime: 2024-09-03 20:57:50
 */
import { http } from '@/utils/http'
export interface IFooItem {
  id: string
  name: object
}

/** GET 请求 */
export const getFooAPI = (name: string) => {
  return http<IFooItem>({
    url: `/foo`,
    method: 'GET',
    query: { name },
  })
}

/** GET 请求 - 再次简化，看大家是否喜欢这种简化 */
export const getFooAPI2 = (name: string) => {
  return http.get<IFooItem>('/foo', { name })
}
//

export const getTenantIdByName = (name: string) => {
  return http.get<IFooItem>('/app-api/system/tenant/get-id-by-name', { name })
}

export const changeIdBy = (data) => {
  return http.post('/app-api/system/auth/change', { ...data })
}

export const getIdByNames = () => {
  return http.get('/app-api/system/tenant/page', { pageSize: 100 })
}
/// app-api/pro/case-query-record/page
export const postRecordAPI = (name) => {
  return http<IFooItem>({
    url: `/app-api/pro/case-query-record/create`,
    method: 'POST',
    data: name,
  })
}
export const updateRecordAPI = (name) => {
  return http<IFooItem>({
    url: `/app-api/pro/case-query-record/update`,
    method: 'PUT',
    data: name,
  })
}
export const getRecordListAPI = (data) => {
  return http.get('/app-api/pro/case-query-record/page', { ...data })
}
export const getJianChaListAPI = (data) => {
  return http.get('/app-api/pro/interview-appointment/page', { ...data })
}
/** POST 请求 */
export const postFooAPI = (name: string) => {
  return http<IFooItem>({
    url: `/foo`,
    method: 'POST',
    query: { name }, // post 请求也支持 query
    data: { name },
  })
}
/** POST 请求 - 再次简化，看大家是否喜欢这种简化 */
export const postFooAPI2 = (name: string) => {
  return http.post<IFooItem>('/foo', { name }, { name })
}
/// app-api/system/auth/weixin-mini-app-login
export const loginApi = (data) => {
  return http({
    url: `/app-api/system/auth/weixin-mini-app-login`,
    method: 'POST',
    data: { ...data },
  })
}
// 检察官登录
// /app-api/system/auth/weixin-mini-app-pro-login
export const leaderLoginApi = (data) => {
  return http({
    url: `/app-api/system/auth/login`,
    method: 'POST',
    data: { ...data },
  })
}
// 用户密码重置
export const updateUserPassword = (data) => {
  return http({
    url: `/app-api/system/user/update-password`,
    method: 'PUT',
    data: { ...data },
  })
}
// 登出系统
export const logout = () => {
  return http.post('/app-api/system/auth/logout')
}
/// infra/file/page
export const getFileistAPI = (data) => {
  return http.get('/app-api/infra/file/page', { ...data })
}
export const getUserListAPI = (data) => {
  return http.get('/app-api/system/user/user_role', { ...data })
}
export const getOperateListAPI = (data) => {
  return http.get('/app-api/pro/operate-center/page', { ...data })
}
export const getWordListAPI = (data) => {
  return http.get('/app-api/pro/word-manager/page', { ...data })
}
export const getPetitionListAPI = (data) => {
  return http.get('/app-api/pro/petition-request-record/page', { ...data })
}
export const getPublicListAPI = (data) => {
  return http.get('/app-api/pro/public-interest-litigation/page', { ...data })
}
export const getDetentionListAPI = (data) => {
  return http.get('/app-api/pro/detention-review-center/page', { ...data })
}
export const getUserId = (data) => {
  return http.get('/app-api/system/role/page', { ...data })
}
export const getInterviewListAPI = (data) => {
  return http.get('/app-api/pro/interview-appointment/page', { ...data })
}

//
export const postOcrAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/send/IdCard`,
    method: 'POST',
    data,
  })
}

export const postOnlineAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/online-message/create`,
    method: 'POST',
    data,
  })
}
export const postDetentionAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/detention-review-center/create`,
    method: 'POST',
    data,
  })
}
export const updateDetentionAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/detention-review-center/update`,
    method: 'PUT',
    data,
  })
}
export const postPublicAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/public-interest-litigation/create`,
    method: 'POST',
    data,
  })
}
export const updatePublicAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/public-interest-litigation/update`,
    method: 'PUT',
    data,
  })
}
export const postPetitionAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/petition-request-record/create`,
    method: 'POST',
    data,
  })
}
export const updatePetitionAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/petition-request-record/update`,
    method: 'PUT',
    data,
  })
}
export const postInterviewAPI = (name) => {
  return http<IFooItem>({
    url: `/app-api/pro/interview-appointment/create`,
    method: 'POST',
    data: name,
  })
}
export const electronicAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/electronic-delivery/create`,
    method: 'POST',
    data,
  })
}
export const getDetentionAPI = (id) => {
  return http.get(`/app-api/pro/detention-review-center/get?id=${id}`)
}
export const getWordAPI = (id) => {
  return http.get(`/app-api/pro/word-manager/get?id=${id}`)
}
export const getPublicAPI = (id) => {
  return http.get(`/app-api/pro/public-interest-litigation/get?id=${id}`)
}
export const getPetitionAPI = (id) => {
  return http.get(`/app-api/pro/petition-request-record/get?id=${id}`)
}
export const getInterviewAPI = (id) => {
  return http.get(`/app-api/pro/interview-appointment/get?id=${id}`)
}
export const getCaseQueryAPI = (id) => {
  return http.get(`/app-api/pro/case-query-record/get?id=${id}`)
}
export const getPopularizeListAPI = (data) => {
  return http.get('/app-api/pro/popularize-law/page', { ...data })
}
export const getPopularizeAPI = (id) => {
  return http.get(`/app-api/pro/popularize-law/get?id=${id}`)
}
export const getElectronicAPI = (data) => {
  return http.get(`/app-api/pro/electronic-delivery/page`, { ...data })
}
export const getElectronicInfoAPI = (id) => {
  return http.get(`/app-api/pro/electronic-delivery/get?id=${id}`)
}
export const getMessageAPI = (data) => {
  return http.get(`/app-api/pro/message-record/page`, { ...data })
}
export const getSecutorInfoAPI = (id) => {
  return http.get(`/app-api/system/user/get?id=${id}`)
}
export const updateNameAPI = (userId, data) => {
  return http<IFooItem>({
    url: `/app-api/system/user/update`,
    method: 'PUT',
    data: { ...data },
    query: { ...userId },
  })
}
export const upElectronicAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/electronic-delivery/update`,
    method: 'PUT',
    data: { ...data },
  })
}
export const upmMessageAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/message-record/update`,
    method: 'PUT',
    data: { ...data },
  })
}
export const upmInterviewAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/interview-appointment/update`,
    method: 'PUT',
    data: { ...data },
  })
}

export const deleteMessageAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/message-record/delete`,
    method: 'delete',
    query: { ...data },
  })
}

export const updateStatusAPI = (data) => {
  return http<IFooItem>({
    url: `/app-api/pro/interview-appointment/update-status`,
    method: 'PUT',
    data: { ...data },
  })
}

// 角色列表

export const getSimpt = () => {
  return http.get('/app-api/system/role/simple-list')
}

export const getUserRoles = (data) => {
  return http.get('/app-api/system/permission/list-user-roles', { ...data })
}
